package com.jims.api.v1.controller.sync;

import com.baomidou.kisso.my.controller.BaseController;
import com.jims.master.common.data.Message;
import com.jims.master.common.utils.SecurityUtil;
import com.jims.master.modules.sync.entity.Lab;
import com.jims.master.modules.sync.entity.LabApply;
import com.jims.master.modules.sync.entity.LabResult;
import com.jims.master.modules.sync.service.LabResultService;
import com.jims.master.modules.sync.service.LabService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2017/11/16 0016.
 */
@RestController
@RequestMapping(value = "/lab")
public class LabController extends BaseController {
    @Autowired
    private LabService labService;
    @Autowired
    private LabResultService labResultService;
    /**
      * @Title: labItem
      * @Description: 查询检验列表信息
      * @param clinicId
      * @param visitId
      * @return
      * @author CT
      * @date 2017/11/20 0017
      * @throws
     */
    @RequestMapping(value = "V100/labItem",method ={RequestMethod.GET,RequestMethod.POST})
     public String labItemV100(String clinicId, String visitId){
	/*	Map<String, Object> map = new HashMap<String, Object>();*/
		/*map.put("registList",registList);*/
        Lab lab = new Lab();
        lab.setClinicId(clinicId);
        lab.setVisitId(visitId);
        List<Lab> labList = labService.getLab(lab);
        Message mes = new Message();
        mes.setData(labList);
        return SecurityUtil.encryptMsgData(mes);
    }

    /**
     * @Title: getLab
     * @Description: 根据住院id查询检验列表信息
     * @param visitId
     * @param visitId
     * @return
     * @author CT
     * @date 2017/11/20 0017
     * @throws
     */
    @RequestMapping(value = "V100/getLab",method ={RequestMethod.GET,RequestMethod.POST})
    public String getLabV100(@RequestParam(required = true)String visitId){
        List<Lab> labList = labService.getLabByVisitId(visitId);
        Message mes = new Message();
        mes.setData(labList);
        return SecurityUtil.encryptMsgData(mes);

    }

     /**
       * @Title: labResult
       * @Description: 根据检查单号查询检查结果
        * @param labApplyNo
       * @return
       * @author CT
       * @date 2017/12/13 0013
       * @throws
      */
    @RequestMapping(value = "V100/labResult",method ={RequestMethod.GET,RequestMethod.POST})
    public String lablabResultV100(@RequestParam(required = true)String labApplyNo){
	/*	Map<String, Object> map = new HashMap<String, Object>();*/
		/*map.put("registList",registList);*/
        List<LabResult> labResultList = labResultService.getResultList(labApplyNo);
        Message mes = new Message();
        mes.setData(labResultList);
        return SecurityUtil.encryptMsgData(mes);
    }

    /**
     * 健康轴查看检验申请
     * @param clinicId
     * @Author WangYQ
     * @return
     */
    @RequestMapping(value = {"V100/getLabApply"})
    public String getLabApply(String clinicId){
        List<Lab> labList = labService.getLabApply(clinicId);
        Message mes = new Message();
        mes.setData(labList);
        return SecurityUtil.encryptMsgData(mes);
    }
}
